﻿-- =========================================================================  
-- Author:  JCC  
-- Create date: 20-03-2012  
-- Description: Consulta de todos los estudios para el catálogo de estudios.   
-- =========================================================================   
CREATE PROCEDURE [dbo].[spObtenPrecioEstPaq](  
@pnIdLaboratorio    INT,  
@pnIdEstudio		INT,
@pnEsPaquete		TINYINT
)    
AS    
BEGIN    
 -- SET NOCOUNT ON added to prevent extra result sets from    
 -- interfering with SELECT statements.    
 SET NOCOUNT ON;    
 IF @pnEsPaquete = 1
 BEGIN
 	SELECT	Precio
 	FROM	dbo.PaqueteEstudio
 	WHERE	IdLaboratorio	= @pnIdLaboratorio
 	AND		IdPaquete		= @pnIdEstudio
 END
 ELSE
 BEGIN
	 SELECT	e.Precio  
	 FROM	dbo.CatEstudio (NOLOCK) e  
	 WHERE	e.IdEstudio		= @pnIdEstudio  
	 and	e.IdLaboratorio = @pnIdLaboratorio    
 END
 
 SET NOCOUNT OFF;    
END